/*
 * SensorsPanel.java
 *
 * Created on 3 de septiembre de 2008, 15:56
 */

package r4p_gui;

/**
 *
 * @author  nemesis
 */
public class SensorsPanel extends javax.swing.JPanel {

    String name;
    String compassSensorName;
    String inc_1SensorName;
    String inc_2SensorName;
    String distanceSensorName;
    String statusOnMessage;
    String statusOffMessage;
    String header;
    
    /** Creates new form SensorsPanel */
    public SensorsPanel() {
        initComponents();
    }
    
    public void reLanguage(String name, String header, String statusOnMessage, String statusOffMessage) {
	this.name = name;
	this.header = header;
	this.statusOnMessage = statusOnMessage;
	this.statusOffMessage = statusOffMessage;
	
	this.labelHeader.setText(this.header);
	this.inclinometerSensor1.relanguage(null, this.statusOnMessage, this.statusOffMessage);
	this.inclinometerSensor2.relanguage(null, this.statusOnMessage, this.statusOffMessage);
	this.compassSensor1.relanguage(null, this.statusOnMessage, this.statusOffMessage);
	this.distanceSensor1.relanguage(null, this.statusOnMessage, this.statusOffMessage);
    }
    
    public void setValues(int incli1, int incli2, int compass, int distance) {
	this.inclinometerSensor1.setValue(incli1);
	this.inclinometerSensor2.setValue(incli2);
	this.distanceSensor1.setValue(distance);
	this.compassSensor1.setValue(compass);
    }
    
    public void setStates(boolean incli1, boolean incli2, boolean compass, boolean distance) {
	this.inclinometerSensor1.setOn(incli1);
	this.inclinometerSensor2.setOn(incli2);
	this.compassSensor1.setOn(compass);
	this.distanceSensor1.setOn(distance);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        inclinometerSensor1 = new r4p_gui.InclinometerSensor();
        inclinometerSensor2 = new r4p_gui.InclinometerSensor();
        compassSensor1 = new r4p_gui.CompassSensor();
        distanceSensor1 = new r4p_gui.DistanceSensor();
        labelHeader = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Sensors", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 0, 10))); // NOI18N

        labelHeader.setIcon(new javax.swing.ImageIcon("/home/nemesis/NetBeansProjects/R4P_gui/icons/sensors.png")); // NOI18N
        labelHeader.setText("Information from environment");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(compassSensor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(inclinometerSensor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(inclinometerSensor2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(distanceSensor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(labelHeader, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(labelHeader, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(inclinometerSensor2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(distanceSensor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(inclinometerSensor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(compassSensor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(16, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private r4p_gui.CompassSensor compassSensor1;
    private r4p_gui.DistanceSensor distanceSensor1;
    private r4p_gui.InclinometerSensor inclinometerSensor1;
    private r4p_gui.InclinometerSensor inclinometerSensor2;
    private javax.swing.JLabel labelHeader;
    // End of variables declaration//GEN-END:variables

}
